CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )

SET( PROJECT_NAME_TEMP "QDisholTest" )

IF( DisholLib_SOURCE_DIR )

	FIND_PACKAGE( Qt4 COMPONENTS QtMain QtCore QtGui )

	IF( QT4_FOUND )

		PROJECT( ${PROJECT_NAME_TEMP} )

		IF (MSVC)
			# Set Unicode as character set for Visual Studio projects. By default it's Multi-Byte
			ADD_DEFINITIONS(-DUNICODE -D_UNICODE)
				
			# Set Warning level to 4
		# Commented because Qt generates warnings...
		#	IF ( CMAKE_CXX_FLAGS MATCHES "/W[0-4]" )
		#		STRING( REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" )
		#	ELSE()
		#		SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4" )
		#  ENDIF()
		ENDIF()

		INCLUDE_DIRECTORIES( ${DisholLib_SOURCE_DIR} )

		SET	(	SOURCES
		
				DisholQImageWidget.h
				DisholQImageWidget.cpp
				DisholQDeviceWidget.h
				DisholQDeviceWidget.cpp
				DisholQDeviceManagerWidget.h
				DisholQDeviceManagerWidget.cpp
			
				Main.cpp 
			)

		QT4_WRAP_CPP( HEADERS_MOC DisholQImageWidget.h )	
		QT4_WRAP_CPP( HEADERS_MOC DisholQDeviceWidget.h )	
		QT4_WRAP_CPP( HEADERS_MOC DisholQDeviceManagerWidget.h )

		INCLUDE( ${QT_USE_FILE} )
		ADD_DEFINITIONS( ${QT_DEFINITIONS} )

		ADD_EXECUTABLE( ${PROJECT_NAME} WIN32 ${SOURCES} ${HEADERS_MOC} )

		TARGET_LINK_LIBRARIES( ${PROJECT_NAME} DisholLib )
		TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${QT_LIBRARIES}) 
	
	ELSE()
	
		MESSAGE("Qt4 not found. Project ${PROJECT_NAME} won't be compiled")
	
	ENDIF()

ELSE()

	MESSAGE("Can't find DisholLib. Project ${PROJECT_NAME_TEMP} won't be compiled")

ENDIF()